package max.ubitest.pipe.commands
{
	import max.ubitest.pipe.data.CellData;
	import max.ubitest.pipe.data.CellValidation;
	import max.ubitest.pipe.events.PipeEvent;
	import max.ubitest.pipe.locators.CellLocator;
	
	import org.robotlegs.mvcs.Command;
	
	public class ClearCellsAroundCommand extends Command
	{
		[Inject]
		public var event:PipeEvent;
		[Inject]
		public var cellLocator:CellLocator;
		
		public function ClearCellsAroundCommand()
		{
			super();
		}
		
		override public function execute():void{
			var v:Vector.<CellData> = cellLocator.getCellsAround(event.data as CellData);
			for each(var c:CellData in v){
				c.componentData = null;
				c.valid = CellValidation.NONE_FITTING;
			}
		}
	}
}